import Mock from 'mockjs'

const dataFn = () => {
  return Array(50)
    .fill(undefined)
    .map(() =>
      Mock.mock({
        id: '@id',
        name: '@ctitle(5, 10)',
      })
    )
}

Mock.mock('/category', 'get', () => {
  return {
    data: dataFn(),
    code: 200,
    message: 'ok',
  }
})
Mock.mock('/subcategory', 'get', () => {
  return {
    data: dataFn(),
    code: 200,
    message: 'ok',
  }
})
Mock.mock('/detail', 'get', () => {
  return {
    data: Mock.Random.cparagraph(50, 100),
    code: 200,
    message: 'ok',
  }
})
